<template>
  <view class="login-container">
    <view class="login-box">
      <view class="welcome">
        <text class="welcome-text">欢迎回来</text>
        <text class="sub-title">请登录您的账号</text>
      </view>
      
      <view class="input-group">
        <view class="input-label">用户名</view>
        <view class="input-wrapper">
          <input type="text" v-model="username" placeholder="请输入用户名" />
          <image class="icon" src="/static/icons/user.svg" mode="aspectFit"></image>
        </view>
      </view>
      
      <view class="input-group">
        <view class="input-label">密码</view>
        <view class="input-wrapper">
          <input :type="showPassword ? 'text' : 'password'" v-model="password" placeholder="请输入密码" />
          <image class="icon" src="/static/icons/lock.svg" mode="aspectFit"></image>
          <image 
            class="icon-eye" 
            :src="showPassword ? '/static/icons/eye.svg' : '/static/icons/eye-off.svg'" 
            mode="aspectFit"
            @tap="showPassword = !showPassword"
          ></image>
        </view>
      </view>
      
      <view class="options-row">
        <view class="remember-me">
          <checkbox :checked="rememberMe" @tap="rememberMe = !rememberMe" color="#6c50fe" />
          <text>记住我</text>
        </view>
        <text class="forgot-password" @tap="forgotPassword">忘记密码?</text>
      </view>
      
      <button class="login-btn" @tap="login">登 录</button>
      
      <view class="register-link">
        <text>还没有账号? </text>
        <text class="link" @tap="goToRegister">立即注册</text>
      </view>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      username: '',
      password: '',
      rememberMe: false,
      showPassword: false
    }
  },
  methods: {
    login() {
      // 登录逻辑
      uni.showToast({
        title: '登录功能开发中',
        icon: 'none'
      })
    },
    forgotPassword() {
      uni.showToast({
        title: '忘记密码功能开发中',
        icon: 'none'
      })
    },
    goToRegister() {
      uni.showToast({
        title: '注册功能开发中',
        icon: 'none'
      })
    }
  }
}
</script>

<style>
.login-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #a6c0fe 0%, #c2a8fd 100%);
  padding: 30rpx;
  box-sizing: border-box;
}

.login-box {
  width: 100%;
  max-width: 650rpx;
  background-color: rgba(255, 255, 255, 0.9);
  border-radius: 30rpx;
  padding: 50rpx 40rpx;
  box-shadow: 0 10rpx 25rpx rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(10px);
}

.welcome {
  text-align: center;
  margin-bottom: 50rpx;
}

.welcome-text {
  font-size: 40rpx;
  font-weight: bold;
  color: #333;
  display: block;
}

.sub-title {
  font-size: 28rpx;
  color: #666;
  margin-top: 10rpx;
  display: block;
}

.input-group {
  margin-bottom: 30rpx;
}

.input-label {
  font-size: 28rpx;
  color: #666;
  margin-bottom: 10rpx;
}

.input-wrapper {
  position: relative;
  border: 1px solid #e0e0e0;
  border-radius: 10rpx;
  height: 80rpx;
  display: flex;
  align-items: center;
}

input {
  flex: 1;
  height: 100%;
  padding: 0 20rpx;
  font-size: 28rpx;
}

.icon {
  width: 40rpx;
  height: 40rpx;
  margin-right: 20rpx;
}

.icon-eye {
  width: 40rpx;
  height: 40rpx;
  margin-right: 20rpx;
  opacity: 0.6;
}

.options-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 40rpx;
  font-size: 24rpx;
}

.remember-me {
  display: flex;
  align-items: center;
}

.remember-me text {
  margin-left: 10rpx;
  color: #666;
}

.forgot-password {
  color: #6c50fe;
}

.login-btn {
  background: linear-gradient(to right, #6c50fe, #c2a8fd);
  color: white;
  border: none;
  border-radius: 10rpx;
  height: 80rpx;
  line-height: 80rpx;
  font-size: 32rpx;
  margin-bottom: 30rpx;
}

.register-link {
  text-align: center;
  font-size: 26rpx;
  color: #666;
}

.link {
  color: #6c50fe;
}
</style>